<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_connect}}".
 *
 * @property int $id
 * @property string $client 客户端
 * @property int $user_id 用户ID
 * @property string $openid 第三方帐号OPENID
 * @property string $unionid 第三方帐号UNIONID
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class UserConnect extends \yii\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%user_connect}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['user_id', 'created_at', 'updated_at'], 'integer'],
            [['client'], 'string', 'max' => 32],
            [['openid', 'unionid'], 'string', 'max' => 64],
            [['client', 'user_id'], 'unique', 'targetAttribute' => ['client', 'user_id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'client' => '客户端',
            'user_id' => '用户ID',
            'openid' => '第三方帐号OPENID',
            'unionid' => '第三方帐号UNIONID',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

}
